<?php


namespace App\Model;


use Encore\Admin\Auth\Database\Administrator;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
use Illuminate\Support\Facades\DB;

class PurchaseOrderDetail extends Model
{

    public $table = "purchase_order_detail";

    protected $fillable = [
        'purchase_order_id',
        'sku',
        'count',
        'user_id',
    ];



    /**
     * @desc 关联商品
     *
     * @return BelongsTo
     *
     * @author: 梅杰[meijie3169@dingtalk.com] at 2020-03-10 16:04:32
     */
    public function good()
    {
        return $this->belongsTo(Good::class,'good_id');
    }



    /**
     * @desc 关联供货商
     *
     * @return BelongsTo
     *
     * @author: 梅杰[meijie3169@dingtalk.com] at 2020-03-10 16:04:32
     */
    public function supplier()
    {
        return $this->belongsTo(Administrator::class,'supplier_id');
    }
}
